package com.pdg.mcplugin.varnish;

import org.bukkit.plugin.PluginManager;

import com.pdg.mcplugin.common.baseclasses.FeatureManagerBase;
import com.pdg.mcplugin.common.baseclasses.PluginBase;

public class Varnish extends PluginBase {

	private FeatureManagerBase<Varnish,VarnishFeatures> featureManager = null;
	public FeatureManagerBase<Varnish,VarnishFeatures> getFeatureManager(){
		if(featureManager==null){
			featureManager = new FeatureManagerBase<Varnish,VarnishFeatures>(this);
		}
		return featureManager;
	}
	
	private VarnishEventListener eventListener = null;
	public VarnishEventListener getEventListener(){
		if(eventListener==null){
			eventListener = new VarnishEventListener(this);
		}
		return eventListener;
	}
	
	private RecipeMaker recipeMaker;
	public RecipeMaker getRecipeMaker(){
		if(recipeMaker==null){
			recipeMaker = new RecipeMaker(this);
		}
		return recipeMaker;
	}

	//plugin manager
	private PluginManager pluginManager;
	public PluginManager getPluginManager(){
		if(pluginManager==null){
			pluginManager = getServer().getPluginManager();
		}
		return pluginManager;
	}
	
	
	@Override
	protected void disablePlugin() {
	}

	@Override
	protected boolean enablePlugin() {
		saveDefaultConfig();
		getRecipeMaker().makeRecipes();
		getPluginManager().registerEvents(getEventListener(), this);
		return true;
	}

}
